// 服饰资讯-列表
function zx_list() {
    let mockData = Mock.mock({
        "list|8": [{
            'img': "@image('240x165',#eac7ce)",
            'title': "@ctitle(15, 20)",
            'desc': "@ctitle(50, 80)",
            'shopname': "@ctitle(5, 10)",
            'viewcount|1000-2000': 1000,
        }]
    });
    new Vue({
        el: '#zx_list',
        data() {
            return {
                topnavlist: {},
                zixunlist:null,
                count:0,
                pages:0
            }
        },
        methods: {
            getData() {
                let that = this;
                this.list = mockData.list;

                //获取咨询列表和总条数
                axios({
                    method: 'get',
                    url: urlParam.domain() + '/api/advisory/list?pages=' + that.pages,
                    responseType: 'stream',
                }).then(function(response) {
                    console.log(response.data.data);
                    that.zixunlist = response.data.data.cmsAdvisoryList;
                    that.count =getPageCount(response.data.data.count,10);

                });
            },
            listen: function(data) {
                let that = this;
                // 翻页事件
                that.pages = data - 1;
                this.getData();
            }
        },
        created() {
            this.getData();
        }
    })
}

// 服饰资讯-详情
function zx_detail() {
    let mockData = Mock.mock({
        "content": "@paragraph(4)",
        "title": "@ctitle(15, 20)",
        "from": "@ctitle(5, 10)",
        'viewcount|1000-2000': 1000,
        'date': '2017-1-12',
        'prev': {
            'href': '',
            'text': '@ctitle(15, 30)',
        },
        'next': {
            'href': '',
            'text': '@ctitle(15, 30)',
        }
    });
    new Vue({
        el: '#zx_detail',
        data() {
            return {
                crumblist: [{
                    'href': '',
                    'text': '首页',
                }, {
                    'href': '',
                    'text': '聚衣商城',
                }, {
                    'href': '',
                    'text': mockData.title,
                }],
                topnavlist:{},
                zixundetail:{}

            }
        },
        methods: {
            getData() {
                let that = this;
                var href = urlParam.href();
                //this.content = mockData.content;
                //this.from = mockData.from;
                this.viewcount = mockData.viewcount;
               // this.date = mockData.date;
                //this.title = mockData.title;
                this.prev = mockData.prev;
                this.next = mockData.next;

                //获取咨询详情
                axios({
                    method: 'get',
                    url: urlParam.domain() + '/api/advisory/detail?id=' + href.advisoryId,
                    responseType: 'stream',
                }).then(function(response) {
                    that.zixundetail = response.data.data;

                });
            }
        },
        created() {
            this.getData();
        },
        components: {

        }
    })
}